home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / wemdemo4.zip / INFO / VIP.1 < prev    next >
Text File  |  1994-09-21  |  51KB  |  1,515 lines

  1. Info file ../info/vip, produced by Makeinfo, -*- Text -*- from input
  2. file vip.texinfo.
  3.  
  4. Distribution
  5. ************
  6.  
  7. Copyright (C) 1987 Masahiko Sato.
  8.  
  9. Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.  
  13. Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided that
  15. the entire resulting derived work is distributed under the terms of a
  16. permission notice identical to this one.
  17.  
  18. Permission is granted to copy and distribute translations of this
  19. manual into another language, under the same conditions as for
  20. modified versions.
  21.  
  22.  
  23. 
  24. File: vip,  Node: Top,  Next: Survey,  Up: (DIR)
  25.  
  26. VIP ***
  27.  
  28. VIP is a Vi emulating package written in Emacs Lisp.  VIP implements
  29. most Vi commands including Ex commands.  It is therefore hoped that
  30. this package will enable you to do Vi style editing under the
  31. powerful GNU Emacs environment.  This info file describes the usage
  32. of VIP assuming that you are fairly accustomed to Vi but not so much
  33. with Emacs.  Also we will concentrate mainly on differences from Vi,
  34. especially features unique to VIP.
  35.  
  36. It is recommended that you read nodes on survey and on customization
  37. before you start using VIP.  Other nodes may be visited as needed.
  38.  
  39. Comments and bug reports are welcome.  Please send messages to
  40. `ms@Sail.Stanford.Edu' if you are outside of Japan and to
  41. `masahiko@sato.riec.tohoku.junet' if you are in Japan.
  42.  
  43. * Menu:
  44.  
  45. * Survey::        A survey of VIP.
  46. * Vi Commands::        Details of Vi commands.
  47. * Ex Commands::        Details of Ex commands.
  48. * Customization::    How to customize VIP.
  49.  
  50.  
  51. 
  52. File: vip,  Node: Survey,  Next: Basic Concepts,  Prev: Top,  Up: Top
  53.  
  54. A Survey of VIP
  55. ***************
  56.  
  57. In this chapter we describe basics of VIP with emphasis on the
  58. features not found in Vi and on how to use VIP under GNU Emacs.
  59.  
  60. * Menu:
  61.  
  62. * Basic Concepts::    Basic concepts in Emacs.
  63. * Loading VIP::        How to load VIP automatically.
  64. * Modes in VIP::    VIP has three modes, which are orthogonal to modes
  65.             in Emacs.
  66. * Differences from Vi:: Differences of VIP from Vi is explained.
  67.  
  68.  
  69. 
  70. File: vip,  Node: Basic Concepts,  Next: Loading VIP,  Prev: Survey,  Up: Survey
  71.  
  72. Basic Concepts
  73. ==============
  74.  
  75. We begin by explaining some basic concepts of Emacs.  These concepts
  76. are explained in more detail in the GNU Emacs Manual.
  77.  
  78. Conceptually, a "buffer" is just a string of ASCII characters and two
  79. special characters PNT ("point") and MRK ("mark") such that the
  80. character PNT occurs exactly once and MRK occurs at most once.  The
  81. "text" of a buffer is obtained by deleting the occurrences of PNT and
  82. MRK.  If, in a buffer, there is a character following PNT then we say
  83. that point is "looking at" the character; otherwise we say that point
  84. is "at the end of buffer".  PNT and MRK are used to indicate
  85. positions in a buffer and they are not part of the text of the
  86. buffer.  If a buffer contains a MRK then the text between MRK and PNT
  87. is called the "region" of the buffer.
  88.  
  89. Emacs provides (multiple) "windows" on the screen, and you can see
  90. the content of a buffer through the window associated with the
  91. buffer.  The cursor of the screen is always positioned on the
  92. character after PNT.
  93.  
  94. A "keymap" is a table that records the bindings between characters
  95. and command functions.  There is the "global keymap" common to all
  96. the buffers.  Each buffer has its "local keymap" that determines the
  97. "mode" of the buffer.  Local keymap overrides global keymap, so that
  98. if a function is bound to some key in the local keymap then that
  99. function will be executed when you type the key.  If no function is
  100. bound to a key in the local map, however, the function bound to the
  101. key in the global map becomes in effect.
  102.  
  103.  
  104. 
  105. File: vip,  Node: Loading VIP,  Next: Modes in VIP,  Prev: Basic Concepts,  Up: Survey
  106.  
  107. Loading VIP
  108. ===========
  109.  
  110. The recommended way to load VIP automatically is to include the line:
  111.  
  112.      (load "vip")
  113.  
  114. in your `.emacs' file.  The `.emacs' file is placed in your home
  115. directory and it will be executed every time you invoke Emacs.  If
  116. you wish to be in vi mode whenver Emacs starts up, you can include
  117. the following line in your `.emacs' file instead of the above line:
  118.  
  119.      (setq term-setup-hook 'vip-mode)
  120.  
  121. (*Note Vi Mode::, for the explanation of vi mode.)
  122.  
  123. Even if your `.emacs' file does not contain any of the above lines,
  124. you can load VIP and enter vi mode by typing the following from
  125. within Emacs.
  126.  
  127.      M-x vip-mode
  128.  
  129.  
  130. 
  131. File: vip,  Node: Modes in VIP,  Next: Emacs Mode,  Prev: Loading VIP,  Up: Survey
  132.  
  133. Modes in VIP
  134. ============
  135.  
  136. Loading VIP has the effect of globally binding `C-z' (`Control-z') to
  137. the function `vip-change-mode-to-vi'. The default binding of `C-z' in
  138. GNU Emacs is `suspend-emacs', but, you can also call `suspend-emacs'
  139. by typing `C-x C-z'.  Other than this, all the key bindings of Emacs
  140. remain the same after loading VIP.
  141.  
  142. Now, if you hit `C-z', the function `vip-change-mode-to-vi' will be
  143. called and you will be in "vi mode".  (Some major modes may locally
  144. bind `C-z' to some special functions.  In such cases, you can call
  145. `vip-change-mode-to-vi' by `execute-extended-command' which is
  146. invoked by `M-x'.  Here `M-x' means `Meta-x', and if your terminal
  147. does not have a META key you can enter it by typing `ESC x'.  The
  148. same effect can also be achieve by typing `M-x vip-mode'.)
  149.  
  150. You can observe the change of mode by looking at the "mode line". 
  151. For instance, if the mode line is:
  152.  
  153.      -----Emacs: *scratch*              (Lisp Interaction)----All------------
  154.  
  155. then it will change to:
  156.  
  157.      -----Vi:    *scratch*              (Lisp Interaction)----All------------
  158.  
  159. Thus the word `Emacs' in the mode line will change to `Vi'.
  160.  
  161. You can go back to the original "emacs mode" by typing `C-z' in vi
  162. mode.  Thus `C-z' toggles between these two modes.
  163.  
  164. Note that modes in VIP exist orthogonally to modes in Emacs.  This
  165. means that you can be in vi mode and at the same time, say, shell mode.
  166.  
  167. Vi mode corresponds to Vi's command mode.  From vi mode you can enter
  168. "insert mode" (which corresponds to Vi's insert mode) by usual Vi
  169. command keys like `i', `a', `o' ... etc.
  170.  
  171. In insert mode, the mode line will look like this:
  172.  
  173.      -----Insert *scratch*              (Lisp Interaction)----All------------
  174.  
  175. You can exit from insert mode by hitting ESC key as you do in Vi.
  176.  
  177. That VIP has three modes may seem very complicated, but in fact it is
  178. not so.  VIP is implemented so that you can do most editing remaining
  179. only in the two modes for Vi (that is vi mode and insert mode).
  180.  
  181. The figure below shows the transition of three modes in VIP.
  182.  
  183.  
  184.      
  185.                      === C-z ==>          == i,o ... ==>
  186.      emacs mode             vi mode                 insert mode
  187.                 <== X-z ===          <=== ESC ====
  188.  
  189. * Menu:
  190.  
  191. * Emacs Mode::        This is the mode you should know better.
  192. * Vi Mode::        Vi commands are executed in this mode.
  193. * Insert Mode::        You can enter text, and also can do editing if you
  194.             know enough Emacs commands.
  195.  
  196.  
  197. 
  198. File: vip,  Node: Emacs Mode,  Next: Vi Mode,  Prev: Modes in VIP,  Up: Modes in VIP
  199.  
  200. Emacs Mode
  201. ----------
  202.  
  203. You will be in this mode just after you loaded VIP.  You can do all
  204. normal Emacs editing in this mode.  Note that the key `C-z' is
  205. globally bound to `vip-change-mode-to-vi'.  So, if you type `C-z' in
  206. this mode then you will be in vi mode.
  207.  
  208.  
  209. 
  210. File: vip,  Node: Vi Mode,  Next: Insert Mode,  Prev: Emacs Mode,  Up: Modes in VIP
  211.  
  212. Vi Mode
  213. -------
  214.  
  215. This mode corresponds to Vi's command mode.  Most Vi commands work as
  216. they do in Vi.  You can go back to emacs mode by typing `C-z'.  You
  217. can enter insert mode, just as in Vi, by typing `i', `a' etc.
  218.  
  219.  
  220. 
  221. File: vip,  Node: Insert Mode,  Next: Differences from Vi,  Prev: Vi Mode,  Up: Modes in VIP
  222.  
  223. Insert Mode
  224. -----------
  225.  
  226. The key bindings in this mode is the same as in the emacs mode except
  227. for the following 4 keys.  So, you can move around in the buffer and
  228. change its content while you are in insert mode.
  229.  
  230. `ESC'
  231.      This key will take you back to vi mode.
  232.  
  233. `C-h'
  234.      Delete previous character.
  235.  
  236. `C-w'
  237.      Delete previous word.
  238.  
  239. `C-z'
  240.      Typing this key has the same effect as typing ESC in emacs mode.
  241.      Thus typing `C-z x' in insert mode will have the same effect as
  242.      typing `ESC x' in emacs mode.
  243.  
  244.  
  245. 
  246. File: vip,  Node: Differences from Vi,  Next: Undoing,  Prev: Insert Mode,  Up: Survey
  247.  
  248. Differences from Vi
  249. ===================
  250.  
  251. The major differences from Vi are explained below.
  252.  
  253. * Menu:
  254.  
  255. * Undoing::        You can undo more in VIP.
  256. * Changing::        Commands for changing the text.
  257. * Searching::        Search commands.
  258. * z Command::        You can now use zH, zM and zL as well as z- etc.
  259. * Counts::        Some Vi commands which do not accept a count now
  260.             accept one.
  261. * Marking::        You can now mark the current point, beginning of
  262.             the buffer etc.
  263. * Region Commands::    You can now give a region as an argument for delete
  264.             commands etc.
  265. * New Commands::    Some new commands not available in Vi are added.
  266. * New Bindings::    Bindings of some keys are changed for the
  267.             convenience of editing under Emacs.
  268. * Window Commands::    Commands for moving among windows etc.
  269. * Buffer Commands::    Commands for selecting buffers etc.
  270. * File Commands::    Commands for visiting files etc.
  271. * Misc Commands::    Other useful commands.
  272.  
  273.  
  274. 
  275. File: vip,  Node: Undoing,  Next: Changing,  Prev: Differences from Vi,  Up: Differences from Vi
  276.  
  277. Undoing
  278. -------
  279.  
  280. You can repeat undoing by the `.' key.  So, `u' will undo a single
  281. change, while `u . . .', for instance, will undo 4 previous changes. 
  282. Undo is undoable as in Vi.  So the content of the buffer will be the
  283. same before and after `u u'.
  284.  
  285.  
  286. 
  287. File: vip,  Node: Changing,  Next: Searching,  Prev: Undoing,  Up: Differences from Vi
  288.  
  289. Changing
  290. --------
  291.  
  292. Some commands which change a small number of characters are executed
  293. slightly differently.  Thus, if point is at the beginning of a word
  294. `foo' and you wished to change it to `bar' by typing `c w', then VIP
  295. will prompt you for a new word in the minibuffer by the prompt `foo
  296. => '.  You can then enter `bar' followed by RET or ESC to complete
  297. the command.  Before you enter RET or ESC you can abort the command
  298. by typing `C-g'.  In general, you can abort a partially formed
  299. command by typing `C-g'.
  300.  
  301.  
  302. 
  303. File: vip,  Node: Searching,  Next: z Command,  Prev: Changing,  Up: Differences from Vi
  304.  
  305. Searching
  306. ---------
  307.  
  308. As in Vi, searching is done by `/' and `?'.  The string will be
  309. searched literally by default.  To invoke a regular expression
  310. search, first execute the search command `/' (or `?') with empty
  311. search string.  (I.e, type `/' followed by RET.) A search for empty
  312. string will toggle the search mode between vanilla search and regular
  313. expression search.  You cannot give an offset to the search string. 
  314. (It is a limitation.)  By default, search will wrap around the buffer
  315. as in Vi.  You can change this by rebinding the variable
  316. `vip-search-wrap-around'.  *Note Customization::, for how to do this.
  317.  
  318.  
  319. 
  320. File: vip,  Node: z Command,  Next: Counts,  Prev: Searching,  Up: Differences from Vi
  321.  
  322. z Command
  323. ---------
  324.  
  325. For those of you who cannot remember which of `z' followed by RET,
  326. `.' and `-' do what.  You can also use `z' followed by `H', `M' and
  327. `L' to place the current line in the Home (Middle, and Last) line of
  328. the window.
  329.  
  330.  
  331. 
  332. File: vip,  Node: Counts,  Next: Marking,  Prev: z Command,  Up: Differences from Vi
  333.  
  334. Counts
  335. ------
  336.  
  337. Some Vi commands which do not accept a count now accept one
  338.  
  339. `p'
  340. `P'
  341.      Given counts, text will be yanked (in Vi's sense) that many
  342.      times.  Thus `3 p' is the same as `p p p'.
  343.  
  344. `o'
  345. `O'
  346.      Given counts, that many copies of text will be inserted. Thus `o
  347.      a b c ESC' will insert 3 lines of `abc' below the current line.
  348.  
  349. `/'
  350. `?'
  351.      Given a count N, N-th occurrence will be searched.
  352.  
  353.  
  354. 
  355. File: vip,  Node: Marking,  Next: Region Commands,  Prev: Counts,  Up: Differences from Vi
  356.  
  357. Marking
  358. -------
  359.  
  360. Typing an `m' followed by a lower case character CH marks the point
  361. to the register named CH as in Vi.  In addition to these, we have
  362. following key bindings for marking.
  363.  
  364. `m <'
  365.      Set mark at the beginning of buffer.
  366.  
  367. `m >'
  368.      Set mark at the end of buffer.
  369.  
  370. `m .'
  371.      Set mark at point (and push old mark on mark ring).
  372.  
  373. `m ,'
  374.      Jump to mark (and pop mark off the mark ring).
  375.  
  376.  
  377. 
  378. File: vip,  Node: Region Commands,  Next: New Commands,  Prev: Marking,  Up: Differences from Vi
  379.  
  380. Region Commands
  381. ---------------
  382.  
  383. Vi operators like `d', `c' etc. are usually used in combination with
  384. motion commands.  It is now possible to use current region as the
  385. argument to these operators.  (A "region" is a part of buffer
  386. delimited by point and mark.)  The key `r' is used for this purpose. 
  387. Thus `d r' will delete the current region.  If `R' is used instead of
  388. `r' the region will first be enlarged so that it will become the
  389. smallest region containing the original region and consisting of
  390. whole lines.  Thus `m . d R' will have the same effect as `d d'.
  391.  
  392.  
  393. 
  394. File: vip,  Node: New Commands,  Next: New Bindings,  Prev: Region Commands,  Up: Differences from Vi
  395.  
  396. Some New Commands
  397. -----------------
  398.  
  399. Note that the keys below (except for `R') are not used in Vi.
  400.  
  401. `C-a'
  402.      Move point to the beginning of line.
  403.  
  404. `C-n'
  405.      If you have two or more windows in the screen, this key will
  406.      move point to the next window.
  407.  
  408. `C-o'
  409.      Insert a newline and leave point before it, and then enter
  410.      insert mode.
  411.  
  412. `C-r'
  413.      Backward incremental search.
  414.  
  415. `C-s'
  416.      Forward incremental search.
  417.  
  418. `C-c'
  419. `C-x'
  420. `ESC'
  421.      These keys will exit from vi mode and return to emacs mode
  422.      temporarily.  If you hit one of these keys, Emacs will be in
  423.      emacs mode and will believe that you hit that key in emacs mode.
  424.      For example, if you hit `C-x' followed by `2', then the current
  425.      window will be split into 2 and you will be in vi mode again.
  426.  
  427. `\'
  428.      Escape to emacs mode.  Hitting `\' will take you to emacs mode,
  429.      and you can execute a single Emacs command.  After executing the
  430.      Emacs command you will be in vi mode again.  You can give a
  431.      count before typing `\'.  Thus `5 \ *', as well as `\ C-u 5 *',
  432.      will insert `*****' before point.  Similarly `1 0 \ C-p' will
  433.      move the point 10 lines above the current line.
  434.  
  435. `K'
  436.      Kill current buffer if it is not modified.  Useful when you
  437.      selected a buffer which you did not want.
  438.  
  439. `Q'
  440. `R'
  441.      `Q' is for query replace and `R' is for replace.  By default,
  442.      string to be replaced are treated literally.  If you wish to do
  443.      a regular expression replace, first do replace with empty string
  444.      as the string to be replaced.  In this way, you can toggle
  445.      between vanilla and regular expression replacement.
  446.  
  447. `v'
  448. `V'
  449.      These keys are used to Visit files.  `v' will switch to a buffer
  450.      visiting file whose name can be entered in the minibuffer. `V'
  451.      is similar, but will use window different from the current window.
  452.  
  453. `#'
  454.      If followed by a certain character CH, it becomes an operator
  455.      whose argument is the region determined by the motion command
  456.      that follows.  Currently, CH can be one of `c', `C', `g', `q'
  457.      and `s'.
  458.  
  459. `# c'
  460.      Change upper case characters in the region to lower case
  461.      (`downcase-region').
  462.  
  463. `# C'
  464.      Change lower case characters in the region to upper case. For
  465.      instance, `# C 3 w' will capitalize 3 words from the current
  466.      point (`upcase-region').
  467.  
  468. `# g'
  469.      Execute last keyboard macro for each line in the region
  470.      (`vip-global-execute').
  471.  
  472. `# q'
  473.      Insert specified string at the beginning of each line in the
  474.      region (`vip-quote-region').
  475.  
  476. `# s'
  477.      Check spelling of words in the region (`spell-region').
  478.  
  479. `*'
  480.      Call last keyboard macro.
  481.  
  482.  
  483. 
  484. File: vip,  Node: New Bindings,  Next: Window Commands,  Prev: New Commands,  Up: Differences from Vi
  485.  
  486. New Key Bindings
  487. ----------------
  488.  
  489. In VIP the meanings of some keys are entirely different from Vi. 
  490. These key bindings are done deliberately in the hope that editing
  491. under Emacs will become easier.  It is however possible to rebind
  492. these keys to functions which behave similarly as in Vi.  *Note
  493. Customizing Key Bindings::, for details.
  494.  
  495. `C-g'
  496. `g'
  497.      In Vi, `C-g' is used to get information about the file
  498.      associated to the current buffer.  Here, `g' will do that, and
  499.      `C-g' is used to abort a command (this is for compatibility with
  500.      emacs mode.)
  501.  
  502. `SPC'
  503. `RET'
  504.      Now these keys will scroll up and down the text of current window.
  505.      Convenient for viewing the text.
  506.  
  507. `s'
  508. `S'
  509.      They are used to switch to a specified buffer.  Useful for
  510.      switching to already existing buffer since buffer name
  511.      completion is provided.  Also a default buffer will be given as
  512.      part of the prompt, to which you can switch by just typing RET
  513.      key.  `s' is used to select buffer in the current window, while
  514.      `S' selects buffer in another window.
  515.  
  516. `C'
  517. `X'
  518.      These keys will exit from vi mode and return to emacs mode
  519.      temporarily.  If you type `C' (`X'), Emacs will be in emacs mode
  520.      and will believe that you have typed `C-c' (`C-x', resp.) in
  521.      emacs mode. Moreover, if the following character you type is an
  522.      upper case letter, then Emacs will believe that you have typed
  523.      the corresponding control character.  You will be in vi mode
  524.      again after the command is executed.  For example, typing `X S'
  525.      in vi mode is the same as typing `C-x C-s' in emacs mode.  You
  526.      get the same effect by typing `C-x C-s' in vi mode, but the idea
  527.      here is that you can execute useful Emacs commands without
  528.      typing control characters. For example, if you hit `X' (or
  529.      `C-x') followed by `2', then the current window will be split
  530.      into 2 and you will be in vi mode again.
  531.  
  532. In addition to these, `ctl-x-map' is slightly modified:
  533.  
  534. `X 3'
  535. `C-x 3'
  536.      This is equivalent to `C-x 1 C-x 2' (1 + 2 = 3).
  537.  
  538.  
  539. 
  540. File: vip,  Node: Window Commands,  Next: Buffer Commands,  Prev: New Bindings,  Up: Differences from Vi
  541.  
  542. Window Commands
  543. ---------------
  544.  
  545. In this and following subsections, we give a summary of key bindings
  546. for basic functions related to windows, buffers and files.
  547.  
  548. `C-n'
  549.      Switch to next window.
  550.  
  551. `X 1'
  552. `C-x 1'
  553.      Delete other windows.
  554.  
  555. `X 2'
  556. `C-x 2'
  557.      Split current window into two windows.
  558.  
  559. `X 3'
  560. `C-x 3'
  561.      Show current buffer in two windows.
  562.  
  563.  
  564. 
  565. File: vip,  Node: Buffer Commands,  Next: File Commands,  Prev: Window Commands,  Up: Differences from Vi
  566.  
  567. Buffer Commands
  568. ---------------
  569.  
  570. `s'
  571.      Switch to the specified buffer in the current window
  572.      (`vip-switch-to-buffer').
  573.  
  574. `S'
  575.      Switch to the specified buffer in another window
  576.      (`vip-switch-to-buffer-other-window').
  577.  
  578. `K'
  579.      Kill the current buffer if it is not modified.
  580.  
  581. `X S'
  582. `C-x C-s'
  583.      Save the current buffer in the file associated to the buffer.
  584.  
  585.  
  586. 
  587. File: vip,  Node: File Commands,  Next: Misc Commands,  Prev: Buffer Commands,  Up: Differences from Vi
  588.  
  589. File Commands
  590. -------------
  591.  
  592. `v'
  593.      Visit specified file in the current window.
  594.  
  595. `V'
  596.      Visit specified file in another window.
  597.  
  598. `X W'
  599. `C-x C-w'
  600.      Write current buffer into the specified file.
  601.  
  602. `X I'
  603. `C-x C-i'
  604.      Insert specified file at point.
  605.  
  606.  
  607. 
  608. File: vip,  Node: Misc Commands,  Next: Vi Commands,  Prev: File Commands,  Up: Differences from Vi
  609.  
  610. Miscellaneous Commands
  611. ----------------------
  612.  
  613. `X ('
  614. `C-x ('
  615.      Start remembering keyboard macro.
  616.  
  617. `X )'
  618. `C-x )'
  619.      Finish remembering keyboard macro.
  620.  
  621. `*'
  622.      Call last remembered keyboard macro.
  623.  
  624. `X Z'
  625. `C-x C-z'
  626.      Suspend Emacs.
  627.  
  628. `Z Z'
  629.      Exit Emacs.
  630.  
  631. `Q'
  632.      Query replace.
  633.  
  634. `R'
  635.      Replace.
  636.  
  637.  
  638. 
  639. File: vip,  Node: Vi Commands,  Next: Numeric Arguments,  Prev: Misc Commands,  Up: Top
  640.  
  641. Vi Commands
  642. ***********
  643.  
  644. This chapter describes Vi commands other than Ex commands implemented
  645. in VIP.  Except for the last section which discusses insert mode, all
  646. the commands described in this chapter are to be used in vi mode.
  647.  
  648. * Menu:
  649.  
  650. * Numeric Arguments::    Many commands accept numeric arguments
  651. * Important Keys::    Some very important keys.
  652. * Buffers and Windows::    Commands for handling buffers and windows.
  653. * Files::        Commands for handling files.
  654. * Viewing the Buffer::    How you can view the current buffer.
  655. * Mark Commands::    Marking positions in a buffer.
  656. * Motion Commands::    Commands for moving point.
  657. * Modifying Commands::    Commands for modifying the buffer.
  658.  
  659.  
  660. 
  661. File: vip,  Node: Numeric Arguments,  Next: Important Keys,  Prev: Vi Commands,  Up: Vi Commands
  662.  
  663. Numeric Arguments
  664. =================
  665.  
  666. Most Vi commands accept a "numeric argument" which can be supplied as
  667. a prefix to the commands.  A numeric argument is also called a "count".
  668. In many cases, if a count is given, the command is executed that many
  669. times.  For instance, `5 d d' deletes 5 lines while simple `d d'
  670. deletes a line.  In this manual the metavariable N will denote a count.
  671.  
  672.  
  673. 
  674. File: vip,  Node: Important Keys,  Next: Buffers and Windows,  Prev: Numeric Arguments,  Up: Vi Commands
  675.  
  676. Important Keys
  677. ==============
  678.  
  679. The keys `C-g' and `C-l' are unique in that their associated
  680. functions are the same in any of emacs, vi and insert mode.
  681.  
  682. `C-g'
  683.      Quit.  Cancel running or partially typed command
  684.      (`keyboard-quit').
  685.  
  686. `C-l'
  687.      Clear the screen and reprint everything (`recenter').
  688.  
  689. In Emacs many commands are bound to the key strokes that start with
  690. `C-x', `C-c' and ESC.  These commands can be accessed from vi mode as
  691. easily as from emacs mode.
  692.  
  693. `C-x'
  694. `C-c'
  695. `ESC'
  696.      Typing one of these keys have the same effect as typing it in
  697.      emacs mode.  Appropriate command will be executed according as
  698.      the keys you type after it.  You will be in vi mode again after
  699.      the execution of the command.  For instance, if you type `ESC <'
  700.      (in vi mode) then the cursor will move to the beginning of the
  701.      buffer and you will still be in vi mode.
  702.  
  703. `C'
  704. `X'
  705.      Typing one of these keys have the effect of typing the
  706.      corresponding control character in emacs mode.  Moreover, if you
  707.      type an upper case character following it, that character will
  708.      also be translated to the corresponding control character.  Thus
  709.      typing `X W' in vi mode is the same as typing `C-x C-w' in emacs
  710.      mode.  You will be in vi mode again after the execution of a
  711.      command.
  712.  
  713. `\'
  714.      Escape to emacs mode.  Hitting the `\' key will take you to
  715.      emacs mode, and you can execute a single Emacs command.  After
  716.      executing the Emacs command you will be in vi mode again.  You
  717.      can give a count before typing `\'.  Thus `5 \ +', as well as `\
  718.      C-u 5 +', will insert `+++++' before point.
  719.  
  720.  
  721. 
  722. File: vip,  Node: Buffers and Windows,  Next: Files,  Prev: Important Keys,  Up: Vi Commands
  723.  
  724. Buffers and Windows
  725. ===================
  726.  
  727. In Emacs the text you edit is stored in a "buffer".  See GNU Emacs
  728. Manual, for details.  There is always one "selected" buffer which is
  729. called the "current buffer".
  730.  
  731. You can see the contents of buffers through "windows" created by Emacs.
  732. When you have multiple windows on the screen only one of them is
  733. selected.  Each buffer has a unique name, and each window has a mode
  734. line which shows the name of the buffer associated with the window
  735. and other information about the status of the buffer.  You can change
  736. the format of the mode line, but normally if you see `**' at the
  737. beginning of a mode line it means that the buffer is "modified".  If
  738. you write out the content of the buffer to a file, then the buffer
  739. will become not modified.  Also if you see `%%' at the beginning of
  740. the mode line, it means that the file associated with the buffer is
  741. write protected.
  742.  
  743. We have the following commands related to windows and buffers.
  744.  
  745. `C-n'
  746.      Move cursor to the next-window (`vip-next-window').
  747.  
  748. `X 1'
  749.      Delete other windows and make the selected window fill the screen 
  750.      (`delete-other-windows').
  751.  
  752. `X 2'
  753.      Split current window into two windows (`split-window-vertically').
  754.  
  755. `X 3'
  756.      Show current buffer in two windows.
  757.  
  758. `s BUFFER RET'
  759.      Select or create a buffer named BUFFER (`vip-switch-to-buffer').
  760.  
  761. `S BUFFER RET'
  762.      Similar but select a buffer named BUFFER in another window 
  763.      (`vip-switch-to-buffer-other-window').
  764.  
  765. `K'
  766.      Kill the current buffer if it is not modified or if it is not
  767.      associated with a file 
  768.      (`vip-kill-buffer').
  769.  
  770. `X B'
  771.      List the existing buffers (`list-buffers').
  772.  
  773. As "buffer name completion" is provided, you have only to type in
  774. initial substring of the buffer name which is sufficient to identify
  775. it among names of existing buffers.  After that, if you hit TAB the
  776. rest of the buffer name will be supplied by the system, and you can
  777. confirm it by RET.  The default buffer name to switch to will also be
  778. prompted, and you can select it by giving a simple RET.  See GNU
  779. Emacs Manual for details of completion.
  780.  
  781.  
  782. 
  783. File: vip,  Node: Files,  Next: Viewing the Buffer,  Prev: Buffers and Windows,  Up: Vi Commands
  784.  
  785. Files
  786. =====
  787.  
  788. We have the following commands related to files.  They are used to
  789. visit, save and insert files.
  790.  
  791. `v FILE RET'
  792.      Visit specified file in the current window (`vip-find-file').
  793.  
  794. `V FILE RET'
  795.      Visit specified file in another window
  796.      (`vip-find-file-other-window').
  797.  
  798. `X S'
  799.      Save current buffer to the file associated with the buffer.  If
  800.      no file is associated with the buffer, the name of the file to
  801.      write out the content of the buffer will be asked in the
  802.      minibuffer.
  803.  
  804. `X W FILE RET'
  805.      Write current buffer into a specified file.
  806.  
  807. `X I FILE RET'
  808.      Insert a specified file at point.
  809.  
  810. `g'
  811.      Give information on the file associated with the current buffer.
  812.      Tell you the name of the file associated with the buffer, the
  813.      line number of the current point and total line numbers in the
  814.      buffer.  If no file is associated with the buffer, this fact
  815.      will be indicated by the null file name `""'.
  816.  
  817. In Emacs, you can edit a file by "visiting" it.  If you wish to visit
  818. a file in the current window, you can just type `v'.  Emacs maintains
  819. the "default directory" which is specific to each buffer.  Suppose,
  820. for instance, that the default directory of the current buffer is
  821. `/usr/masahiko/lisp/'.  Then you will get the following prompt in the
  822. minibuffer.
  823.  
  824.      visit file: /usr/masahiko/lisp/
  825.  
  826. If you wish to visit, say, `vip.el' in this directory, then you can
  827. just type `vip.el' followed by RET.  If the file `vip.el' already
  828. exists in the directory, Emacs will visit that file, and if not, the
  829. file will be created.  Emacs will use the file name (`vip.el', in
  830. this case) as the name of the buffer visiting the file.  In order to
  831. make the buffer name unique, Emacs may append `<2>', `<3>' etc., to
  832. the buffer name.  As the "file name completion" is provided here, you
  833. can sometime save typing.  For instance, suppose there is only one
  834. file in the default directory whose name starts with `v', that is
  835. `vip.el'.  Then if you just type `v TAB' then it will be completed to
  836. `vip.el'.  Thus, in this case, you just have to type `v v TAB RET' to
  837. visit `/usr/masahiko/lisp/vip.el'.  Continuing the example, let us
  838. now suppose that you wished to visit the file
  839. `/usr/masahiko/man/vip.texinfo'.  Then to the same prompt which you
  840. get after you typed `v', you can enter
  841. `/usr/masahiko/man/vip.texinfo' or `../man/vip.texinfo' followed by
  842. RET.
  843.  
  844. Use `V' instead of `v', if you wish to visit a file in another window.
  845.  
  846. You can verify which file you are editing by typing `g'.  (You can
  847. also type `X B' to get nformation on other buffers too.)  If you type
  848. `g' you will get an information like below in the echo area:
  849.  
  850.      "/usr/masahiko/man/vip.texinfo" line 921 of 1949
  851.  
  852. After you edited the buffer (`vip.texinfo', in our example) for a
  853. while, you may wish to save it in a file.  If you wish to save it in
  854. the file associated with the buffer (`/usr/masahiko/man/vip.texinfo',
  855. in this case), you can just say `X S'.  If you wish to save it in
  856. another file, you can type `X W'.  You will then get a similar prompt
  857. as you get for `v', to which you can enter the file name.
  858.  
  859.  
  860. 
  861. File: vip,  Node: Viewing the Buffer,  Next: Mark Commands,  Prev: Files,  Up: Vi Commands
  862.  
  863. Viewing the Buffer
  864. ==================
  865.  
  866. In this and next section we discuss commands for moving around in the
  867. buffer.  These command do not change the content of the buffer.  The
  868. following commands are useful for viewing the content of the current
  869. buffer.
  870.  
  871. `SPC'
  872. `C-f'
  873.      Scroll text of current window upward almost full screen.  You
  874.      can go forward in the buffer by this command (`vip-scroll').
  875.  
  876. `RET'
  877. `C-b'
  878.      Scroll text of current window downward almost full screen.  You
  879.      can go backward in the buffer by this command (`vip-scroll-back').
  880.  
  881. `C-d'
  882.      Scroll text of current window upward half screen.  You can go
  883.      down in the buffer by this command (`vip-scroll-down').
  884.  
  885. `C-u'
  886.      Scroll text of current window downward half screen.  You can go
  887.      up in the buffer by this command (`vip-scroll-up').
  888.  
  889. `C-y'
  890.      Scroll text of current window upward by one line
  891.      (`vip-scroll-down-one').
  892.  
  893. `C-e'
  894.      Scroll text of current window downward by one line
  895.      (`vip-scroll-up-one').
  896.  
  897. You can repeat these commands by giving a count.  Thus, `2 SPC' has
  898. the same effect as `SPC SPC'.
  899.  
  900. The following commands reposition point in the window.
  901.  
  902. `z H'
  903. `z RET'
  904.      Put point on the top (home) line in the window.  So the current
  905.      line becomes the top line in the window.  Given a count N, point
  906.      will be placed in the N-th line from top (`vip-line-to-top').
  907.  
  908. `z M'
  909. `z .'
  910.      Put point on the middle line in the window.  Given a count N,
  911.      point will be placed in the N-th line from the middle line
  912.      (`vip-line-to-middle').
  913.  
  914. `z L'
  915. `z -'
  916.      Put point on the bottom line in the window.  Given a count N,
  917.      point will be placed in the N-th line from bottom
  918.      (`vip-line-to-bottom').
  919.  
  920. `C-l'
  921.      Center point in window and redisplay screen (`recenter').
  922.  
  923.  
  924. 
  925. File: vip,  Node: Mark Commands,  Next: Motion Commands,  Prev: Viewing the Buffer,  Up: Vi Commands
  926.  
  927. Mark Commands
  928. =============
  929.  
  930. The following commands are used to mark positions in the buffer.
  931.  
  932. `m CH'
  933.      Store current point in the register CH.  CH must be a lower case
  934.      character between `a' and `z'.
  935.  
  936. `m <'
  937.      Set mark at the beginning of current buffer.
  938.  
  939. `m >'
  940.      Set mark at the end of current buffer.
  941.  
  942. `m .'
  943.      Set mark at point.
  944.  
  945. `m ,'
  946.      Jump to mark (and pop mark off the mark ring).
  947.  
  948. Emacs uses the "mark ring" to store marked positions.  The commands
  949. `m <', `m >' and `m .' not only set mark but also add it as the
  950. latest element of the mark ring (replacing the oldest one).  By
  951. repeating the command ``m ,'' you can visit older and older marked
  952. positions.  You will eventually be in a loop as the mark ring is a
  953. ring.
  954.  
  955.  
  956. 
  957. File: vip,  Node: Motion Commands,  Next: Searching and Replacing,  Prev: Mark Commands,  Up: Vi Commands
  958.  
  959. Motion Commands
  960. ===============
  961.  
  962. Commands for moving around in the current buffer are collected here. 
  963. These commands are used as an `argument' for the delete, change and
  964. yank commands to be described in the next section.
  965.  
  966. `h'
  967.      Move point backward by one character.  Signal error if point is
  968.      at the beginning of buffer, but (unlike Vi) do not complain
  969.      otherwise (`vip-backward-char').
  970.  
  971. `l'
  972.      Move point backward by one character.  Signal error if point is
  973.      at the end of buffer, but (unlike Vi) do not complain otherwise
  974.      (`vip-forward-char').
  975.  
  976. `j'
  977.      Move point to the next line keeping the current column.  If
  978.      point is on the last line of the buffer, a new line will be
  979.      created and point will move to that line (`vip-next-line').
  980.  
  981. `k'
  982.      Move point to the previous line keeping the current column
  983.      (`vip-next-line').
  984.  
  985. `+'
  986.      Move point to the next line at the first non-white character. 
  987.      If point is on the last line of the buffer, a new line will be
  988.      created and point will move to the beginning of that line
  989.      (`vip-next-line-at-bol').
  990.  
  991. `-'
  992.      Move point to the previous line at the first non-white character
  993.      (`vip-previous-line-at-bol').
  994.  
  995. If a count is given to these commands, the commands will be repeated
  996. that many times.
  997.  
  998. `0'
  999.      Move point to the beginning of line (`vip-beginning-of-line').
  1000.  
  1001. `^'
  1002.      Move point to the first non-white character on the line
  1003.      (`vip-bol-and-skip-white').
  1004.  
  1005. `$'
  1006.      Move point to the end of line (`vip-goto-eol').
  1007.  
  1008. `N |'
  1009.      Move point to the N-th column on the line (`vip-goto-col').
  1010.  
  1011. Except for the `|' command, these commands neglect a count.
  1012.  
  1013. `w'
  1014.      Move point forward to the beginning of the next word
  1015.      (`vip-forward-word').
  1016.  
  1017. `W'
  1018.      Move point forward to the beginning of the next word, where a
  1019.      "word" is considered as a sequence of non-white characters
  1020.      (`vip-forward-Word').
  1021.  
  1022. `b'
  1023.      Move point backward to the beginning of a word
  1024.      (`vip-backward-word').
  1025.  
  1026. `B'
  1027.      Move point backward to the beginning of a word, where a word is
  1028.      considered as a sequence of non-white characters
  1029.      (`vip-forward-Word').
  1030.  
  1031. `e'
  1032.      Move point forward to the end of a word (`vip-end-of-word').
  1033.  
  1034. `E'
  1035.      Move point forward to the end of a word, where a word is
  1036.      considered as a sequence of non-white characters
  1037.      (`vip-end-of-Word').
  1038.  
  1039. Here the meaning of the word `word' for the `w', `b' and `e' commands
  1040. is determined by the "syntax table" effective in the current buffer. 
  1041. Each major mode has its syntax mode, and therefore the meaning of a
  1042. word also changes as the major mode changes.  See GNU Emacs Manual
  1043. for details of syntax table.
  1044.  
  1045. `H'
  1046.      Move point to the beginning of the home (top) line of the window.
  1047.      Given a count N, go to the N-th line from top (`vip-window-top').
  1048.  
  1049. `M'
  1050.      Move point to the beginning of the middle line of the window. 
  1051.      Given a count N, go to the N-th line from the middle line
  1052.      (`vip-window-middle').
  1053.  
  1054. `L'
  1055.      Move point to the beginning of the lowest (bottom) line of the
  1056.      window.  Given count, go to the N-th line from bottom
  1057.      (`vip-window-bottom').
  1058.  
  1059. These commands can be used to go to the desired line visible on the
  1060. screen.
  1061.  
  1062. `('
  1063.      Move point backward to the beginning of the sentence
  1064.      (`vip-backward-sentence').
  1065.  
  1066. `)'
  1067.      Move point forward to the end of the sentence
  1068.      (`vip-forward-sentence').
  1069.  
  1070. `{'
  1071.      Move point backward to the beginning of the paragraph
  1072.      (`vip-backward-paragraph').
  1073.  
  1074. `}'
  1075.      Move point forward to the end of the paragraph
  1076.      (`vip-forward-paragraph').
  1077.  
  1078. A count repeats the effect for these commands.
  1079.  
  1080. `G'
  1081.      Given a count N, move point to the N-th line in the buffer on
  1082.      the first non-white character.  Without a count, go to the end
  1083.      of the buffer (`vip-goto-line').
  1084.  
  1085. `` `'
  1086.      Exchange point and mark (`vip-goto-mark').
  1087.  
  1088. `` CH'
  1089.      Move point to the position stored in the register CH.  CH must
  1090.      be a lower case letter.
  1091.  
  1092. `' ''
  1093.      Exchange point and mark, and then move point to the first
  1094.      non-white character on the line (`vip-goto-mark-and-skip-white').
  1095.  
  1096. `' CH'
  1097.      Move point to the position stored in the register CH and skip to
  1098.      the first non-white character on the line.  CH must be a lower
  1099.      case letter.
  1100.  
  1101. `%'
  1102.      Move point to the matching parenthesis if point is looking at
  1103.      `(', `)', `{', `}', `[' or `]' 
  1104.      (`vip-paren-match').
  1105.  
  1106. The command `G' mark point before move, so that you can return to the
  1107. original point by `` `'.  The original point will also be stored in
  1108. the mark ring.
  1109.  
  1110. The following commands are useful for moving points on the line.  A
  1111. count will repeat the effect.
  1112.  
  1113. `f CH'
  1114.      Move point forward to the character CH on the line.  Signal
  1115.      error if CH could not be found (`vip-find-char-forward').
  1116.  
  1117. `F CH'
  1118.      Move point backward to the character CH on the line.  Signal
  1119.      error if CH could not be found (`vip-find-char-backward').
  1120.  
  1121. `t CH'
  1122.      Move point forward upto the character CH on the line.  Signal
  1123.      error if CH could not be found (`vip-goto-char-forward').
  1124.  
  1125. `T CH'
  1126.      Move point backward upto the character CH on the line.  Signal
  1127.      error if CH could not be found (`vip-goto-char-backward').
  1128.  
  1129. `;'
  1130.      Repeat previous `f', `t', `F' or `T' command (`vip-repeat-find').
  1131.  
  1132. `,'
  1133.      Repeat previous `f', `t', `F' or `T' command, in the opposite
  1134.      direction (`vip-repeat-find-opposite').
  1135.  
  1136.  
  1137. 
  1138. File: vip,  Node: Searching and Replacing,  Next: Modifying Commands,  Prev: Motion Commands,  Up: Vi Commands
  1139.  
  1140. Searching and Replacing
  1141. =======================
  1142.  
  1143. Following commands are available for searching and replacing.
  1144.  
  1145. `/ STRING RET'
  1146.      Search the first occurrence of the string STRING forward
  1147.      starting from point.  Given a count N, the N-th occurrence of
  1148.      STRING will be searched.  If the variable `vip-re-search' has
  1149.      value `t' then "regular expression" search is done and the
  1150.      string matching the regular expression STRING is found.  If you
  1151.      give an empty string as STRING then the search mode will change
  1152.      from vanilla search to regular expression search and vice versa
  1153.      (`vip-search-forward').
  1154.  
  1155. `? STRING RET'
  1156.      Same as `/', except that search is done backward
  1157.      (`vip-search-backward').
  1158.  
  1159. `n'
  1160.      Search the previous search pattern in the same direction as
  1161.      before (`vip-search-next').
  1162.  
  1163. `N'
  1164.      Search the previous search pattern in the opposite direction
  1165.      (`vip-search-Next').
  1166.  
  1167. `C-s'
  1168.      Search forward incrementally.  See GNU Emacs Manual for details
  1169.      (`isearch-forward').
  1170.  
  1171. `C-r'
  1172.      Search backward incrementally (`isearch-backward').
  1173.  
  1174. `R STRING RET NEWSTRING'
  1175.      There are two modes of replacement, "vanilla" and "regular
  1176.      expression".  If the mode is vanilla you will get a prompt
  1177.      `Replace string:', and if the mode is regular expression you
  1178.      will ge a prompt `Replace regexp:'.  The mode is initially
  1179.      vanilla, but you can toggle these modes by giving a null string
  1180.      as STRING.  If the mode is vanilla, this command replaces every
  1181.      occurrence of STRING with NEWSTRING.  If the mode is regular
  1182.      expression, STRING is treated as a regular expression and every
  1183.      string matching the regular expression is replaced with
  1184.      NEWSTRING (`vip-replace-string').
  1185.  
  1186. `Q    STRING RET NEWSTRING'
  1187.      Same as `R' except that you will be asked form confirmation
  1188.      before each replacement 
  1189.      (`vip-query-replace').
  1190.  
  1191. `r CH'
  1192.      Replace the character point is looking at by the character CH. 
  1193.      Give count, replace that many characters by CH
  1194.      (`vip-replace-char').
  1195.  
  1196. The commands `/' and `?' mark point before move, so that you can
  1197. return to the original point by `` `'.
  1198.  
  1199.  
  1200. 
  1201. File: vip,  Node: Modifying Commands,  Next: Delete Commands,  Prev: Searching and Replacing,  Up: Vi Commands
  1202.  
  1203. Modifying Commands
  1204. ==================
  1205.  
  1206. In this section, commands for modifying the content of a buffer are
  1207. described.  These commands affect the region determined by a motion
  1208. command which is given to the commands as their argument.
  1209.  
  1210. We classify motion commands into "point commands" and "line
  1211. commands".  The point commands are as follows:
  1212.  
  1213.      `h', `l', `0', `^', `$', `w', `W', `b', `B', `e', `E', `(', `)', `/', `?', ``', `f', `F', `t', `T', `%', `;', `,'
  1214.  
  1215. The line commands are as follows:
  1216.  
  1217.      `j', `k', `+', `-', `H', `M', `L', `{', `}', `G', `''
  1218.  
  1219. If a point command is given as an argument to a modifying command,
  1220. the region determined by the point command will be affected by the
  1221. modifying command. On the other hand, if a line command is given as
  1222. an argument to a modifying command, the region determined by the line
  1223. command will be enlarged so that it will become the smallest region
  1224. properly containing the region and consisting of whole lines (we call
  1225. this process "expanding the region"), and then the enlarged region
  1226. will be affected by the modifying command.
  1227.  
  1228. * Menu:
  1229.  
  1230. * Delete Commands::    Commands for deleting text.
  1231. * Yank Commands::    Commands for yanking text in Vi's sense.
  1232. * Put Back Commands::    Commands for putting bake deleted/yanked text.
  1233. * Change Commands::    Commands for changing text.
  1234.  
  1235.  
  1236. 
  1237. File: vip,  Node: Delete Commands,  Next: Yank Commands,  Prev: Modifying Commands,  Up: Modifying Commands
  1238.  
  1239. Delete Commands
  1240. ---------------
  1241.  
  1242. `d MOTION-COMMAND'
  1243.      Delete the region determined by the motion command MOTION-COMMAND.
  1244.  
  1245. For example, `d $' will delete the region between point and end of
  1246. current line since `$' is a point command that moves point to end of
  1247. line.  `d G' will delete the region between the beginning of current
  1248. line and end of the buffer, since `G' is a line command.  A count
  1249. given to the command above will become the count for the associated
  1250. motion command.  Thus, `3 d w' will delete three words.
  1251.  
  1252. It is also possible to save the deleted text into a register you
  1253. specify.  For example, you can say `" t 3 d w' to delete three words
  1254. and save it to register `t'.  The name of a register is a lower case
  1255. letter between `a' and `z'.  If you give an upper case letter as an
  1256. argument to a delete command, then the deleted text will be appended
  1257. to the content of the register having the corresponding lower case
  1258. letter as its name.  So, `" T d w' will delete a word and append it
  1259. to register `t'.  Other modifying commands also accept a register
  1260. name as their argument, and we will not repeat similar explanations.
  1261.  
  1262. We have more delete commands as below.
  1263.  
  1264. `d d'
  1265.      Delete a line.  Given a count N, delete N lines.
  1266.  
  1267. `d r'
  1268.      Delete current region.
  1269.  
  1270. `d R'
  1271.      Expand current region and delete it.
  1272.  
  1273. `D'
  1274.      Delete to the end of a line (`vip-kill-line').
  1275.  
  1276. `x'
  1277.      Delete a character after point.  Given N, delete N characters
  1278.      (`vip-delete-char').
  1279.  
  1280. `DEL'
  1281.      Delete a character before point.  Given N, delete N characters
  1282.      (`vip-delete-backward-char').
  1283.  
  1284.  
  1285. 
  1286. File: vip,  Node: Yank Commands,  Next: Put Back Commands,  Prev: Delete Commands,  Up: Modifying Commands
  1287.  
  1288. Yank Commands
  1289. -------------
  1290.  
  1291. Yank commands "yank" a text of buffer into a (usually anonymous)
  1292. register.  Here the word `yank' is used in Vi's sense.  Thus yank
  1293. commands do not alter the content of the buffer, and useful only in
  1294. combination with commands that put back the yanked text into the
  1295. buffer.
  1296.  
  1297. `y MOTION-COMMAND'
  1298.      Yank the region determined by the motion command MOTION-COMMAND.
  1299.  
  1300. For example, `y $' will yank the text between point and the end of
  1301. line into an anonymous register, while `"c y $' will yank the same
  1302. text into register `c'.
  1303.  
  1304. Use the following command to yank consecutive lines of text.
  1305.  
  1306. `y y'
  1307. `Y'
  1308.      Yank a line.  Given N, yank N lines (`vip-yank-line').
  1309.  
  1310. `y r'
  1311.      Yank current region.
  1312.  
  1313. `y R'
  1314.      Expand current region and yank it.
  1315.  
  1316.  
  1317. 
  1318. File: vip,  Node: Put Back Commands,  Next: Change Commands,  Prev: Yank Commands,  Up: Modifying Commands
  1319.  
  1320. Put Back Commands
  1321. -----------------
  1322.  
  1323. Deleted or yanked texts can be put back into the buffer by the
  1324. command below.
  1325.  
  1326. `p'
  1327.      Insert, after the character point is looking at, most recently
  1328.      deleted/yanked text from anonymous register. Given a register
  1329.      name argument, the content of the named register will be put
  1330.      back.  Given a count, the command will be repeated that many
  1331.      times. This command also checks if the text to put back ends
  1332.      with a new line character, and if so the text will be put below
  1333.      the current line (`vip-put-back').
  1334.  
  1335. `P'
  1336.      Insert at point most recently deleted/yanked text from anonymous
  1337.      register.  Given a register name argument, the content of the
  1338.      named register will be put back.  Given a count, the command
  1339.      will be repeated that many times.  This command also checks if
  1340.      the text to put back ends with a new line character, and if so
  1341.      the text will be put above the current line rather than at point
  1342.      (`vip-Put-back').
  1343.  
  1344. Thus, `" c p' will put back the content of the register `c' into the
  1345. buffer.  It is also possible to specify "number register" which is a
  1346. numeral between `1' and `9'.  If the number register N is specified,
  1347. N-th previously deleted/yanked text will be put back.  It is an error
  1348. to specify a number register for the delete/yank commands.
  1349.  
  1350.  
  1351. 
  1352. File: vip,  Node: Change Commands,  Next: Repeating and Undoing Modifications,  Prev: Put Back Commands,  Up: Modifying Commands
  1353.  
  1354. Change Commands
  1355. ---------------
  1356.  
  1357. Most commonly used change command takes the following form.
  1358.  
  1359. `c MOTION-COMMAND'
  1360.      Replace the content of the region determined by the motion
  1361.      command MOTION-COMMAND by the text you type.  If the motion
  1362.      command is a point command then you will type the text into
  1363.      minibuffer, and if the motion command is a line command then the
  1364.      region will be deleted first and you can insert the text in
  1365.      INSERT MODE.
  1366.  
  1367. For example, if point is at the beginning of a word `foo' and you
  1368. wish to change it to `bar', you can type `c w'.  Then, as `w' is a
  1369. point command, you will get the prompt `foo =>' in the minibuffer,
  1370. for which you can type `b a r RET' to complete the change command.
  1371.  
  1372. `c c'
  1373.      Change a line.  Given a count, that many lines are changed.
  1374.  
  1375. `c r'
  1376.      Change current region.
  1377.  
  1378. `c R'
  1379.      Expand current region and change it.
  1380.  
  1381.  
  1382. 
  1383. File: vip,  Node: Repeating and Undoing Modifications,  Next: Other Vi Commands,  Prev: Change Commands,  Up: Modifying Commands
  1384.  
  1385. Repeating and Undoing Modifications
  1386. -----------------------------------
  1387.  
  1388. VIP records the previous modifying command, so that it is easy to
  1389. repeat it.  It is also very easy to undo changes made by modifying
  1390. commands.
  1391.  
  1392. `u'
  1393.      Undo the last change.  You can undo more by repeating undo by
  1394.      the repeat command `.'.  For example, you can undo 5 previous
  1395.      changes by typing `u....'.  If you type `uu', then the second
  1396.      `u' undoes the first undo command (`vip-undo').
  1397.  
  1398. `.'
  1399.      Repeat the last modifying command.  Given count N it becomes the
  1400.      new count for the repeated command.  Otherwise, the count for
  1401.      the last modifying command is used again (`vip-repeat').
  1402.  
  1403.  
  1404. 
  1405. File: vip,  Node: Other Vi Commands,  Next: Commands in Insert Mode,  Prev: Repeating and Undoing Modifications,  Up: Vi Commands
  1406.  
  1407. Other Vi Commands
  1408. =================
  1409.  
  1410. Miscellaneous Vi commands are collected here.
  1411.  
  1412. `Z Z'
  1413.      Exit Emacs.  If modified buffers exist, you will be asked
  1414.      whether you wish to save them or not (`save-buffers-kill-emacs').
  1415.  
  1416. `! MOTION-COMMAND FORMAT-COMMAND'
  1417. `N ! ! FORMAT-COMMAND'
  1418.      The region determined by the motion command MOTION-COMMAND will
  1419.      be given to the shell command FORMAT-COMMAND and the region will
  1420.      be replaced by its output.  If a count is given, it will be
  1421.      passed to MOTION-COMMAND.  For example, `3!Gsort' will sort the
  1422.      region between point and the 3rd line.  If `!' is used instead
  1423.      of MOTION-COMMAND then N lines will be processed by
  1424.      FORMAT-COMMAND (`vip-command-argument').
  1425.  
  1426. `J'
  1427.      Join two lines.  Given count, join that many lines.  A space
  1428.      will be inserted at each junction (`vip-join-lines').
  1429.  
  1430. `< MOTION-COMMAND'
  1431. `N < <'
  1432.      Shift region determined by the motion command MOTION-COMMAND to
  1433.      left by SHIFT-WIDTH (default is 8).  If `<' is used instead of
  1434.      MOTION-COMMAND then shift N lines 
  1435.      (`vip-command-argument').
  1436.  
  1437. `> MOTION-COMMAND'
  1438. `N > >'
  1439.      Shift region determined by the motion command MOTION-COMMAND to
  1440.      right by SHIFT-WIDTH (default is 8).  If `<' is used instead of
  1441.      MOTION-COMMAND then shift N lines 
  1442.      (`vip-command-argument').
  1443.  
  1444. `= MOTION-COMMAND'
  1445.      Indent region determined by the motion command MOTION-COMMAND. 
  1446.      If `=' is used instead of MOTION-COMMAND then indent N lines
  1447.      (`vip-command-argument').
  1448.  
  1449. `*'
  1450.      Call last remembered keyboard macro.
  1451.  
  1452. `#'
  1453.      A new vi operator. *Note New Commands::, for more details.
  1454.  
  1455. The following keys are reserved for future extensions, and currently
  1456. assigned to a function that just beeps (`vip-nil').
  1457.  
  1458.      &, @, U, [, ], _, q, ~
  1459.  
  1460. VIP uses a special local keymap to interpret key strokes you enter in
  1461. vi mode.  The following keys are bound to NIL in the keymap. 
  1462. Therefore, these keys are interpreted by the global keymap of Emacs. 
  1463. We give below a short description of the functions bound to these
  1464. keys in the global keymap.  See GNU Emacs Manual for details.
  1465.  
  1466. `C-@'
  1467.      Set mark and push previous mark on mark ring (`set-mark-command').
  1468.  
  1469. `TAB'
  1470.      Indent line for current major mode (`indent-for-tab-command').
  1471.  
  1472. `LFD'
  1473.      Insert a newline, then indent according to mode
  1474.      (`newline-and-indent').
  1475.  
  1476. `C-k'
  1477.      Kill the rest of the current line; before a newline, kill the
  1478.      newline.  With prefix argument, kill that many lines from point.
  1479.      Negative arguments kill lines backward (`kill-line').
  1480.  
  1481. `C-l'
  1482.      Clear the screen and reprint everything (`recenter').
  1483.  
  1484. `N C-p'
  1485.      Move cursor vertically up N lines (`previous-line').
  1486.  
  1487. `C-q'
  1488.      Read next input character and insert it.  Useful for inserting
  1489.      control characters 
  1490.      (`quoted-insert').
  1491.  
  1492. `C-r'
  1493.      Search backward incrementally (`isearch-backward').
  1494.  
  1495. `C-s'
  1496.      Search forward incrementally (`isearch-forward').
  1497.  
  1498. `N C-t'
  1499.      Interchange charcters around point, moving forward one
  1500.      character.  With count N, take character before point and drag
  1501.      it forward past N other characters.  If no argument and at end
  1502.      of line, the previous two characters are exchanged
  1503.      (`transpose-chars').
  1504.  
  1505. `N C-v'
  1506.      Scroll text upward N lines.  If N is not given, scroll near full
  1507.      screen (`scroll-up').
  1508.  
  1509. `C-w'
  1510.      Kill between point and mark.  The text is save in the kill ring.
  1511.      The command `P' or `p' can retrieve it from kill ring
  1512.      (`kill-region').
  1513.  
  1514.  
  1515.